package com.meessiom.train.crm.order.service;


import com.meessiom.train.crm.order.model.OrderInfo;
import com.meessiom.train.crm.order.repository.OrderInfoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderInfoService {
    public OrderInfo save(OrderInfo orderInfo) {
        return orderInfoRepository.save(orderInfo);
    }

    @Autowired
    private OrderInfoRepository orderInfoRepository;

    public List<OrderInfo>  getAllOrders(){
        return  orderInfoRepository.findAll();
    }


    public OrderInfo createOrder(OrderInfo order)  {
        return orderInfoRepository.save(order);
    }

    public void delete(long id){
        OrderInfo o =orderInfoRepository.getById(id);
        orderInfoRepository.delete(o);
    }
}
